package com.egao.common.component.elasticsearch.entity;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * ElasticSearch 搜索结果
 * @author lym
 */
@Data
public class ElasticSearchResult {

    private Integer code;
    private String msg;

    private String category;
    private String keyword;
    private Integer page;
    private Integer limit;
    private Integer total;
    private List<Map<String, Object>> dataList = new ArrayList<>();

    public ElasticSearchResult() {
        this.code = 1;
        this.msg = "操作失败";
    }

    public ElasticSearchResult(String msg) {
        this.code = 1;
        this.msg = msg;
    }

    public ElasticSearchResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ElasticSearchResult(String category, String keyword, int page, int limit, int total, List<Map<String, Object>> dataList) {
        this.code = 0;
        this.msg = "操作成功";
        this.category = category;
        this.keyword = keyword;
        this.page = page;
        this.limit = limit;
        this.total = total;
        this.dataList = dataList;
    }

}
